<?php
/**
 * BenderController
 * @author Juan Carlos Jarquin
 */

abstract class BenderController
{

    /**
     * Action to be dispatched
     */
    protected $actionName = '';
    protected $request = null;
    
    public function BenderController()
    {
      $this->request = BenderRequest::getInstance();
    }


    /**
     * The arguments
     */
    private $args = array();

    /**
     * The dispatch method [FINAL]
     */
    final public function dispatch()
    {
        $action = Formatter::SlugToCamelCase($this->request->getAction());
        $method = new ReflectionMethod($this, $action . 'Action');
        $method->invoke($this);
    }

    /**
     * postDispatch Method
     */
    public function postDispatch()
    {
    }

    /**
     * preDispatch Method
     */
    public function preDispatch()
    {
    }

    /**
     * Set the arguments
     * @param Array
     */
    public function setArgs($args)
    {
        $this->args = $args;
    }



}
